package com.onlyMe.base
{
	import com.flesler.componentas.core.base.BaseEntity;
	import com.qb9.flashlib.logs.Logger;
	import com.qb9.flashlib.utils.ClassUtil;
	import com.qb9.flashlib.utils.StringUtil;
	
	import flash.utils.getQualifiedClassName;
	
	/**
	 * @author ariel
	 */
	public class BasicEntity extends BaseEntity
	{
		private var logs:LoggerWrapper;
		protected var destroyed:Boolean = false;
		
		public function BasicEntity(prefix:String)
		{
			init(prefix);
		}
		
		private function init(prefix:String):void
		{
			logs = new LoggerWrapper(prefix);
		}
		
		// Logging
		
		protected final function debug(...args:Array):void { logs.debug(args); }
		protected final function info(...args:Array):void { logs.info(args); }
		protected final function warning(...args:Array):void { logs.warning(args); }
		protected final function error(...args:Array):void { logs.error(args); }
		
		// Disposing
		
		override public function destroy():void
		{
			if (destroyed)
				return warning('Trying to destroy an already destroyed object');

			destroyed = true;
			logs = null;
			super.destroy();
		}
	}
}
